<template>
  <div>测测试page</div>
  <el-link type="primary">{{ link }}</el-link>

  <el-link :href="link">
    <div class="link-text">
      {{ link }}
    </div>
  </el-link>

  
</template>

<script setup>
import { listContribute } from "@/api/content/contribute/contribute.js";
import { oauthLocalLoginPassword } from "@/api/auth/oauth/oauth.js";
import { useUserStore } from "@/store/auth/userStore.js";
import { Person } from "@/model/test_person.js";
import { ref } from "vue";
const userStore = useUserStore();

const testContributeList = async () => {
  var data = {};
  var res = await listContribute(data);
  console.log(res);
};

const login = async () => {
  var param = {
    grant_type: "password",
    scope: "all",
    password: "123",
    username: '{"phone":"123","authType":"password"}',
  };

  var res = await oauthLocalLoginPassword(param);
  console.log(res);
  userStore.setUserToken(res.access_token);
  console.log(userStore.getUserToken());
};

const showlogin = () => {
  console.log(userStore.getUserToken());
};

// showlogin();

// setTimeout(() => {
// }, 1000);

// 这种写法可能会出现错误
// login();
// testContributeList();

const excute = async () => {
  await login();
  testContributeList();
};
excute();

const link = ref(
  "http://localhost:8080/media/file/image/675184421936921c3a3f9d76"
);

let person = ref(new Person());
console.log(person);
</script>

<style lang="scss">
.link-text {
  white-space: pre-line; /* 保持文本中的换行符，并在必要时进行换行 */
}
</style>
